#ifndef __MCLINESEGMENT2D_H_
#define __MCLINESEGMENT2D_H_

#include <MCPlaneItem.h>
#include <MCPoint2D.h>
#include <MCVector2.h>
#include <MCMatrix3.h>

class MCLineSegment2D : public MCPlaneItem
{
public:

    MCLineSegment2D() = default;
    MCLineSegment2D(const MCPoint2D &startPoint, const MCPoint2D &endPoint);
    MCLineSegment2D(const MCPoint2D &startPoint, const MCVector2 &direction, double length);
    MCLineSegment2D(const MCLineSegment2D &);

    MCPlaneItemType type() override;
    void rotate(double angleInDegree);
    void setPositionAt(const MCPoint2D &at) override;
    void scale(double scale) override;
    void move(const MCVector2 &to) override;
    void transform(const MCMatrix3 &transform) override;

    void update(const MCPoint2D &p1, const MCPoint2D &p2);

    MCPoint2D startPoint() const;
    MCPoint2D endPoint() const;
    MCPoint2D midPoint() const;

    MCVector2 direction() const;
    double angle() const;
    MCVector2 normal() const;
    double length() const;

    bool operator==(const MCLineSegment2D &) const;
    bool operator!=(const MCLineSegment2D &) const;

private:

    MCPoint2D _startPoint;
    MCPoint2D _endPoint;

};

#endif // !__MCLINESEGMENT2D_H_
